package cat.joronya.supermanager.europeo.team;

import java.io.IOException;
import java.io.Serializable;
import java.util.HashMap;


import cat.joronya.supermanager.europeo.Supermanager;
import cat.joronya.supermanager.europeo.market.Player;

public class Team implements Serializable 
{
	private static final long serialVersionUID = -7089126755370183423L;

	private String idPriv;
	private String idEqu;
	private Integer day;
	private Integer yourWeekDay;
	private String name;
	private Integer status;
	private Integer teamPlayers;
	private Integer changesTotal;
	private Integer changesDone;
	private String manager;
	private String city;
	private Float points;
	private Integer pointsClassification;
	private Float general;
	private Integer generalClassification;
	private Integer broker;
	private Integer brokerClassification;
	private Float pointsBest;
	private Integer generalBest;
	private Float pointsAverage;
	private Integer bestClassification;
	private Integer cash;
	private Integer earnings;
	private Float averageSeason;
	private Float averageVariation;
	private Integer cancelChanges;
	private HashMap<Integer, Player> players;
	private Integer positionOnLeague;
	public boolean selected;
	
	public Team() {
		this.players = new HashMap<Integer,Player>();
		this.status = Supermanager.MyTeam.STATUS_NORMAL;
		this.teamPlayers = 0;
		this.cancelChanges = 0;
		this.changesDone = 0;
		this.changesTotal = 0;
		this.selected = false;
	}
	
	public String getIdPriv() {
		return idPriv;
	}

	public void setIdPriv(String idPriv) {
		this.idPriv = idPriv;
	}

	public String getIdEqu() {
		return idEqu;
	}

	public void setIdEqu(String idEqu) {
		this.idEqu = idEqu;
	}

	public Integer getDay() {
		return day;
	}

	public void setDay(Integer day) {
		this.day = day;
	}

	public Integer getYourWeekDay() {
		return yourWeekDay;
	}

	public void setYourWeekDay(Integer yourWeekDay) {
		this.yourWeekDay = yourWeekDay;
	}

	public String getName() 
	{
		return name;
	}
	
	public void setName(String name) 
	{
		this.name = name;
	}
	
	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getTeamPlayers() {
		return teamPlayers;
	}

	public void setTeamPlayers(Integer teamPlayers) {
		this.teamPlayers = teamPlayers;
	}

	public Integer getChangesTotal() {
		return changesTotal;
	}

	public void setChangesTotal(Integer changesTotal) {
		this.changesTotal = changesTotal;
	}

	public Integer getChangesDone() {
		return changesDone;
	}

	public void setChangesDone(Integer changesDone) {
		this.changesDone = changesDone;
	}

	public String getManager() 
	{
		return manager;
	}
	
	public void setManager(String manager) 
	{
		this.manager = manager;
	}
	public Float getPoints() 
	{
		return points;
	}
	
	public void setPoints(Float points) 
	{
		this.points = points;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public Float getGeneral() {
		return general;
	}

	public void setGeneral(Float general) {
		this.general = general;
	}

	public Integer getBroker() {
		return broker;
	}

	public void setBroker(Integer broker) {
		this.broker = broker;
	}

	public HashMap<Integer,Player> getPlayers() {
		return players;
	}

	public void setPlayers(HashMap<Integer,Player> players) {
		this.players = players;
	}
	
	public void setPointsToPosition(int points, float averagePoints, int position) {
		this.players.get(position).setPoints(points);
		this.players.get(position).setAveragePoints(averagePoints);
	}
	
	public void setReboundsToPosition(int rebounds, float averageRebounds, int position) {
		this.players.get(position).setRebounds(rebounds);
		this.players.get(position).setAverageRebounds(averageRebounds);
	}
	
	public void setThreeToPosition(int three, float averageThree, int position) {
		this.players.get(position).setThree(three);
		this.players.get(position).setAverageThree(averageThree);
	}
	
	public void setAssistencesToPosition(int assistences, float averageAssistences, int position) {
		this.players.get(position).setAssistences(assistences);
		this.players.get(position).setAverageAssistences(averageAssistences);
	}
	
	public void addPlayer(Integer position, Player player) {
		this.players.put(position,player);
	}

	public Integer getPointsClassification() {
		return pointsClassification;
	}

	public void setPointsClassification(Integer pointsClassification) {
		this.pointsClassification = pointsClassification;
	}

	public Integer getGeneralClassification() {
		return generalClassification;
	}

	public void setGeneralClassification(Integer generalClassification) {
		this.generalClassification = generalClassification;
	}

	public Integer getBrokerClassification() {
		return brokerClassification;
	}

	public void setBrokerClassification(Integer brokerClassification) {
		this.brokerClassification = brokerClassification;
	}

	public Float getPointsBest() {
		return pointsBest;
	}

	public void setPointsBest(Float pointsBest) {
		this.pointsBest = pointsBest;
	}

	public Integer getGeneralBest() {
		return generalBest;
	}

	public void setGeneralBest(Integer generalBest) {
		this.generalBest = generalBest;
	}

	public Float getPointsAverage() {
		return pointsAverage;
	}

	public void setPointsAverage(Float pointsAverage) {
		this.pointsAverage = pointsAverage;
	}

	public Integer getBestClassification() {
		return bestClassification;
	}

	public void setBestClassification(Integer bestClassification) {
		this.bestClassification = bestClassification;
	}

	public Integer getCash() {
		return cash;
	}

	public void setCash(Integer cash) {
		this.cash = cash;
	}

	public Integer getEarnings() {
		return earnings;
	}

	public void setEarnings(Integer earnings) {
		this.earnings = earnings;
	}

	public Float getAverageSeason() {
		return averageSeason;
	}

	public void setAverageSeason(Float averageSeason) {
		this.averageSeason = averageSeason;
	}

	public Float getAverageVariation() {
		return averageVariation;
	}

	public void setAverageVariation(Float averageVariation) {
		this.averageVariation = averageVariation;
	}

	public Integer getCancelChanges() {
		return cancelChanges;
	}

	public void setCancelChanges(Integer cancelChanges) {
		this.cancelChanges = cancelChanges;
	}

	public Integer getPositionOnLeague() {
		return positionOnLeague;
	}

	public void setPositionOnLeague(Integer positionOnLeague) {
		this.positionOnLeague = positionOnLeague;
	}
	
	public boolean isSelected() {
		return this.selected;
	}
	
	public void setSelected(boolean selected) {
		this.selected = selected;
	}

	public void toggle() {
		this.selected = !this.selected;
	}

	private void readObject(java.io.ObjectInputStream stream)
		throws IOException, ClassNotFoundException
	{
		//always perform the default de-serialization first
		stream.defaultReadObject();
	}

	private void writeObject(java.io.ObjectOutputStream stream)
		throws IOException
	{
		//perform the default serialization for all non-transient, non-static fields
		stream.defaultWriteObject();
	}
}
